(function($) {
$.viewport = {
	position: function() {
		var xScroll, yScroll;

		if ( self.pageYOffset ) {
			yScroll = self.pageYOffset;
			xScroll = self.pageXOffset;
		} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
			yScroll = document.documentElement.scrollTop;
			xScroll = document.documentElement.scrollLeft;
		} else if (document.body) {// all other Explorers
			yScroll = document.body.scrollTop;
			xScroll = document.body.scrollLeft;	
		}

		return {left: xScroll, top: yScroll};
	},
	left: function() {
		return $.viewport.position().left;
	},
	top: function() {
		return $.viewport.position().top;
	},
	dimensions: function() {
		var windowWidth, windowHeight;
		if ( self.innerHeight ) {	// all except Explorer
			if ( document.documentElement.clientWidth ) {
				windowWidth = document.documentElement.clientWidth; 
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if ( document.documentElement && document.documentElement.clientHeight ) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if ( document.body ) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}
		return {width: windowWidth, height: windowHeight};
	},
	height: function() {
		return $.viewport.dimensions().height;
	},
	width: function() {
		return $.viewport.dimensions().width;
	},
	attributes: function() {
		var position = this.position();
		var dimensions = this.dimensions();
		return {left: position.left, top: position.top, width: dimensions.width, height: dimensions.height};
	}
};
})(jQuery);